{% extends 'base.html' %}
{% block title %}个人中心{% endblock %}
{% block content %}
    <style type="text/css">
            body {
                font-family: Arial, sans-serif;
                background-color: #f4f4f4;
                color: #333;
                margin: 0;
                padding: 20px;
            }

            table {
                width: 100%;
                border-collapse: collapse;
                margin-bottom: 20px;
            }

            th, td {
                padding: 10px;
                text-align: left;
                border: 1px solid #ddd;
            }

            th {
                background-color: #4CAF50;
                color: white;
            }

            a {
                color: #007BFF;
                text-decoration: none;
            }

            a:hover {
                text-decoration: underline;
            }

            p {
                font-size: 18px;
                color: #777;
    </style>
    用户名：{{username}}
    <br>
    我发布的书：<br>
    {% if booklist %}
    <table border="1">
        <thead>
            <th>id</th>
            <th>username</th>
            <th>bookname</th>
            <th>price</th>
            <th>major</th>
            <th>grade</th>
            <th>qq</th>
            <th>pic</th>
            <th>编辑</th>
        </thead>
        <tbody>
        {% for book in booklist %}
            <tr>
                <td>{{ book.id }}</td>
                <td>{{ book.username }}</td>
                <td>{{ book.bookname }}</td>
                <td>{{ book.price }}</td>
                <td>{{ book.major }}</td>
                <td>{{ book.grade }}</td>
                <td>{{ book.qq }}</td>
                <td>{{ book.pic }}</td>
                <td><a href="/delete/{{ book.id }}">删除</a></td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% endif %}
    我购买的书：<br>
    {% if bookbuy %}
    <table border="2">
        <thead>
            <th>id</th>
            <th>username</th>
            <th>bookname</th>
            <th>price</th>
            <th>major</th>
            <th>grade</th>
            <th>qq</th>
            <th>pic</th>
        </thead>
        <tbody>
        {% for book in bookbuy %}
            <tr>
                <td>{{ book.id }}</td>
                <td>{{ book.username }}</td>
                <td>{{ book.bookname }}</td>
                <td>{{ book.price }}</td>
                <td>{{ book.major }}</td>
                <td>{{ book.grade }}</td>
                <td>{{ book.qq }}</td>
                <td>{{ book.pic }}</td>
                <td>{{ book.type }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% else %}
    <p>
    您还没有购买书籍
    </p>
    {% endif %}
{% endblock %}